package com.hl;

import com.hl.entity.Emp;
import com.hl.entity.Salary;
import com.hl.mapper.EmpMapper;
import com.hl.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test7Emp {
    public static void main(String[] args) throws IOException {

        // 获取会话
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        EmpMapper mapper = sqlSession.getMapper(EmpMapper.class);

        List<Emp> list = mapper.selectEmpBySalary1(5000,8000);
        for (Emp emp : list) {
            System.out.println(emp);
        }

/*
        List<Emp> list2 = mapper.selectEmpBySalary2(7000,8000);
        for (Emp emp : list2) {
            System.out.println(emp);
        }
*/

/*        Salary salary = new Salary();
        salary.setSalary1(8000);
        salary.setSalary2(9000);
        List<Emp> list3 = mapper.selectEmpBySalary3(salary);
        for (Emp emp : list3) {
            System.out.println(emp);
        }*/

/*        Map<String,Integer> map = new HashMap<>();
        map.put("salary1",8000);
        map.put("salary2",9000);
        List<Emp> list4 = mapper.selectEmpBySalary4(map);
        for (Emp emp : list4) {
            System.out.println(emp);
        }*/
        MybatisUtils.closeSqlSession(sqlSession);
    }
}
